<template>
	<view>
		<view class="radio_box" v-for="(item, index) in options" :key="index">
			<template v-if="showCheck(checked, item.name)">
				<view :class="['iconfont', showCheck(checked, item.name) ? 'iconfont-e721' : 'iconfont-e720']"></view>
				<view class="val">{{ item.name }}</view>
			</template>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			checked: {
				type: String,
				default: ''
			},
			options: {
				type: Array,
				default: []
			}
		},
		computed: {
			showCheck(str, name) {
				return (str, name) => {
					let arr = (str || '').split(',')
					return arr.some(item => {
						return item === name;
					});
				};
			}
		},
		data() {
			return {};
		},

		mounted() {},

		methods: {}
	};
</script>

<style scoped lang="scss">
	.radio_box {
		display: flex;
		line-height: 50rpx;

		.iconfont {
			margin-right: 10rpx;
		}

		.iconfont-e721 {
			color: var(--color);
		}

		.iconfont-e720 {
			color: #333;
		}
	}
</style>
